Skip to content

feat(strands-agents-sdk): upgrade to v1.62.0, fix context compression, add subagent, middleware and swarm examples - #87

Open
martimfasantos wants to merge 5 commits into
mainfrom
clean/update-strands-1.59.0
Open

martimfasantos wants to merge 5 commits into
mainfrom
clean/update-strands-1.59.0

Conversation

@martimfasantos

@martimfasantos martimfasantos commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR upgrades Strands Agents from 1.55.1 to 1.62.0, fixes 18_context_compression.py (it crashed on the new context-manager model), repoints every docs link after the strandsagents.com reorganisation, and adds examples for the new vended subagent and swarm tools and the public middleware API.


What changed

Package upgrade

  • strands-agents upgraded from 1.55.1 → 1.62.0
  • strands-agents-tools upgraded from 0.8.8 → 0.8.10
  • pyproject.toml floors raised to match (were >=1.47.0 / >=0.5.2)

Existing examples updated

File Change
18_context_compression.py Sections 5–6 rewritten; sections 1–4 unchanged. It crashed with AttributeError on .summary_ratio.
12_multi_agent_graph.py Docs URL, plus set_execution_timeout(300.0). Since 1.60.0 build() warns when a graph has no execution limit.
All 24 other pre-existing example files Docs URL only. Each For more details link returned 404.

On 18: since 1.56.0, context_manager="auto" installs a strategy-based ContextManager plugin and the agent's conversation_manager becomes a NullConversationManager. Section 6 also taught that an explicit conversation_manager overrides auto; it is now ignored with a warning. Section 5 now shows what auto / agentic actually register. Section 6 builds a pipeline from named presets plus a hand-pinned Offload.summarize(...) strategy, and proves offloading happened: a 16,026-char tool result reached the model as a 4,120-char preview.

On the URLs: /user-guide/concepts/ became /user-guide/sdk/, and quickstart/ and observability-evaluation/ moved under sdk/. All 23 unique URLs were verified to return 200.

New examples added

File Feature Docs
26_subagent_tool.py make_subagent() with two Preset roles, a model Choice whose Option values are model instances, a custom builder, and max_depth=1 Vended tools — subagent
27_middleware.py agent.add_middleware() — an InvokeModelStage.Input handler adds a note to each call's system prompt, an Output handler logs stop reason and tokens, and an ExecuteToolStage Wrap handler blocks delete_file without running it (0 executions, file still present) Middleware
28_swarm_tool.py make_swarm() with researcher / writer presets and instructions=Fixed(); prints the team the model asked for and the streamed handoff path, ending in a 3-bullet answer Vended tools — swarm

Key changes in v1.55.1 → v1.62.0

  • Strategy-based ContextManager (1.56.0) — summarize / truncate / drop pipelines with four named presets; context_manager="auto" now uses it.
  • handoff_to_user and mcp_router vended tools; Graph/Swarm session snapshots (1.57.0). Unknown limits keys now raise TypeError.
  • Agent.shutdown() and with Agent(...) / async with Agent(...) (1.57.1) — flush memory on exit; new a2a_client tool.
  • Bidirectional streaming agent is GA (1.57.2) — moved from strands.experimental.bidi to strands.bidi.
  • Agent(aux_model=...) (1.58.0) — routes side calls (summaries, memory extraction, goal judge) to a cheaper model.
  • subagent / make_subagent vended tool with axis policies (1.59.0).
  • python_repl vended tool, namespaced stash storage and OTel baggage (1.60.0); OpenAI usage fixes, and graphs warn when built without an execution limit.
  • MCP request _meta and a content_filtered stop reason (1.61.0).
  • Public middleware (add_middleware) and a swarm vended tool (1.62.0); agent.cancel(message=, after_current_tools=), the stop tool moves to strands.vended_tools, and an experimental OpenAI Live bidi provider.

Notes

  • New setting OPENAI_STRONG_MODEL_NAME (default gpt-4.1). 26 offers it as the "strong" Option; it is in settings.py and .env.example.
  • 26 passes its own builder on purpose. The default builder only grants children tools the manager itself holds, so the manager would have the order tool and could skip delegating.
  • The manager prompt asks for one delegation at a time. Without it the model called both children in parallel and the writer received no facts.
  • 28's model may omit agent_type for an agent. An omitted preset falls back to the first one (researcher), as the captured run shows.
  • 20_human_in_the_loop.py prints a new interrupt wording since 1.59.0 (Approve "transfer_funds"?). The code is unchanged and its OUTPUTS.md section is left as captured.
  • Some runs print an httpcore2 shutdown traceback on stderr at exit. It predates this upgrade and the examples still exit 0.

Configuration

  • All examples use OpenAI (gpt-4o-mini) via settings.py; 26 also uses OPENAI_STRONG_MODEL_NAME
  • Dependencies: strands-agents>=1.62.0, strands-agents-tools>=0.8.10, pydantic-settings
  • Managed with uv package manager

Testing

All 29 examples ran with exit code 0 against v1.62.0. OUTPUTS.md updated for the five touched files (12, 18, 26, 27, 28) plus the header; the other 24 sections are unchanged. uv lock --check, uv sync --frozen and py_compile pass locally.

@martimfasantos martimfasantos added size:M Reviewable diff of 150-299 lines (excludes uv.lock, OUTPUTS.md) framework:strands-agents-sdk Touches the strands-agents-sdk/ framework folder labels Oct 11, 2026
@martimfasantos martimfasantos changed the title feat(strands-agents-sdk): upgrade to v1.59.0, fix context compression example and docs links, and add subagent tool example feat(strands-agents-sdk): upgrade to v1.62.0, fix context compression, add subagent, middleware and swarm examples Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework:strands-agents-sdk Touches the strands-agents-sdk/ framework folder size:M Reviewable diff of 150-299 lines (excludes uv.lock, OUTPUTS.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant